<?php defined('APP_PATH') or exit('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加会员</title>
<link rel="stylesheet" type="text/css" href="vonuo/static/css/vonuo.css">
<script type="text/javascript" src="vonuo/static/js/jquery.min.js"></script>
<script type="text/javascript" src="vonuo/static/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
//选项卡
function setTab(name,cursel,n){
	for(i=1;i<=n;i++){
		var menu=document.getElementById(name+i);
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=i==cursel?"hover":"";
		con.style.display=i==cursel?"block":"none";
	}
}
var ajax_status = false;
function check(){
	if($.trim($("input[name='usercode']").val()).match(/^[a-z0-9]{5,20}$/g) == null){
		$("#need_usercode").html("<strong style='color:red;'>账号格式为[5-20]位小写字母和数字组成！</strong>");
		$("input[name='usercode']").focus();
		return false;
	}else{
		var value = $.trim($("input[name='usercode']").val());
		var url = "<?php echo spUrl('user','checkcode');?>";
		$.post(url,{usercode:value},function(result){
			if(result == '1'){
				$("#need_usercode").html("<strong style='color:red;'>该账号已存在！</strong>");
			}else if(result == '0'){
				ajax_status = true;
				$("#need_usercode").html("<strong style='color:red;'>√</strong>");
			}
		});
		if(ajax_status == false){
			return false;
		}
	}
	if($("select[name='groupid']").val() == 'false'){
		$("#need_groupid").html("<strong style='color:red;'>请选择会员分组！</strong>");
		return false;
	}else{
		$("#need_groupid").html("<strong style='color:red;'>√</strong>");
	}
	if($.trim($("input[name='password']").val()).match(/^[A-Za-z0-9]{5,20}$/g) == null){
		$("#need_password").html("<strong style='color:red;'>密码格式为[5-20]位字母和数字组成！</strong>");
		$("input[name='password']").focus();
		return false;
	}else{
		$("#need_password").html("<strong style='color:red;'>√</strong>");
	}
	if($.trim($("input[name='password']").val()) != $.trim($("input[name='password2']").val())){
		$("#need_password2").html("<strong style='color:red;'>两次输入的密码不一致！</strong>");
		$("input[name='password2']").focus();
		return false;
	}else{
		$("#need_password2").html("<strong style='color:red;'>√</strong>");
	}
	return true;
}
</script>
</head>

<body>
<div class="gs_wraper gs_p_l0">
	<div class="title">
		<a href="javascript:;" id="one1" onclick="setTab('one',1,2)"  class="hover">基本资料</a>
		<a href="javascript:;" id="one2" onclick="setTab('one',2,2)">加盟信息</a>
	</div>
	<form action="<?php echo spUrl('user','doadd');?>" method="post">
	<div class="tab_box" id="con_one_1">
		<table border="0" cellspacing="0" cellpadding="0" class="table_btm">
			<tr>
				<td class="txt_right txt_s_blue">会员账号：</td>
				<td>
					<input name="usercode" type="text" class="blue_input input_w_175" />
					<span id="need_usercode"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">会员姓名：</td>
				<td>
					<input name="username" type="text" class="blue_input input_w_175" />
					<span id="need_username"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">会员分组：</td>
				<td>
					<select name="groupid" class="blue_input input_w_175 f_left"><option value="false"></option>
					<?php foreach($ucat as $row){?><option value="<?php echo $row['id'];?>"><?php echo $row['ucatname'];?></option><?php }?>
					</select>
					<span id="need_groupid" style="margin-left:8px;"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">登录密码：</td>
				<td>
					<input name="password" type="password" class="blue_input input_w_175" />
					<span id="need_password"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">重复密码：</td>
				<td>
					<input name="password2" type="password" class="blue_input input_w_175" />
					<span id="need_password2"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">会员性别：</td>
				<td><input name="sex" type="radio" value="0" checked class="blue_input" />男　 
				<input name="sex" type="radio" value="1" class="blue_input" />女</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">电话：</td>
				<td><input name="tel" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">手机：</td>
				<td><input name="mobile" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">邮箱：</td>
				<td><input name="email" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">QQ：</td>
				<td><input name="qq" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">邮编：</td>
				<td><input name="zip" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">联系地址：</td>
				<td><textarea name="address" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td></td>
				<td><a href="javascript:;" onclick="if(check()){$('form').submit();}" class="sure_submit f_left time">确 定</a><a href="<?php echo spUrl('user','lis');?>" class="return_btn f_left">返 回</a></td>
			</tr>
		</table>
	</div>
	<!--con_one_1 end-->
	<div class="tab_box" id="con_one_2" style="margin-bottom:10px;display:none">
		<table border="0" cellspacing="0" cellpadding="0" class="table_btm">
			<tr>
				<td class="txt_right txt_s_blue">会员状态：</td>
				<td><input name="status" type="radio" value="1" checked class="blue_input" />正常
				<input name="status" type="radio" value="0" class="blue_input" />禁用</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">账户积分：</td>
				<td><input name="jifen" type="text" value="0" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">消费金额：</td>
				<td><input name="money" type="text" value="0.00" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">开业时间：</td>
				<td><input name="kysj" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">加盟性质：</td>
				<td>
					<select name="jmxz" class="blue_input input_w_175 f_left">
					<?php foreach($jmxz as $k=>$v){?><option value="<?php echo $k;?>"><?php echo $v;?></option><?php }?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">经营状况：</td>
				<td>
					<select name="jyzk" class="blue_input input_w_175 f_left">
					<?php foreach($jyzk as $k=>$v){?><option value="<?php echo $k;?>"><?php echo $v;?></option><?php }?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">客户等级：</td>
				<td>
					<select name="khdj" class="blue_input input_w_175 f_left">
					<?php foreach($khdj as $k=>$v){?><option value="<?php echo $k;?>"><?php echo $v;?></option><?php }?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">销售状况：</td>
				<td>
					<select name="xsqk" class="blue_input input_w_175 f_left">
					<?php foreach($xsqk as $k=>$v){?><option value="<?php echo $k;?>"><?php echo $v;?></option><?php }?>
					</select>
					<span id="need_cid" style="margin-left:8px;"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">店面地址：</td>
				<td><textarea name="dmdz" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">性格特点：</td>
				<td><textarea name="xgtd" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">特别留意：</td>
				<td><textarea name="tbly" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">备注信息：</td>
				<td><textarea name="note" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td></td>
				<td><a href="javascript:;" onclick="if(check()){$('form').submit();}" class="sure_submit f_left time">确 定</a><a href="<?php echo spUrl('user','lis');?>" class="return_btn f_left">返 回</a></td>
			</tr>
		</table>
	</div>
	<!--con_one_2 end-->
	</form>
</div>
</body>
</html>